package com.yaowk.sfp.demo.server.controller;

import com.yaowk.sfp.common.base.BaseException;
import com.yaowk.sfp.demo.DemoApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@Api(tags = "demo-server")
public class DemoController implements DemoApi {

    @Override
    @ApiOperation("api1Get")
    public void api1Get() {
        System.out.println("apiGet");
    }

    @Override
    @ApiOperation("api1Post")
    public String api1Post() {
        return "api1Post";
    }

    @Override
    @ApiOperation("api1Put")
    public List<String> api1Put() {
        List<String> result = new ArrayList<String>();
        result.add("api1Put1");
        result.add("api1Put2");
        result.add("api1Put3");
        throw new BaseException("server exception");
//        return result;
    }
}
